{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import re\n",
    "text='我 的 个 人 网 页 的 网 址 是：https://jiy34ui90able, 邮 箱 是：f_9034@qq.com。'\n",
    "print(re.sub('\\d','#',text))    #将“数字”替换为#号\n",
    "print(re.sub('\\D','#',text))    #将非“数字”替换为#号\n",
    "print(re.sub('\\s','#',text))    #将空格替换为#号\n",
    "print(re.sub('\\S','#',text))    #将非空格替换为#号\n",
    "#将汉字、字母、数字、下划线替换为#号\n",
    "print(re.sub('\\w','#',text))\n",
    "#将非汉字、字母、数字、下划线替换为#号\n",
    "print(re.sub('\\W','#',text))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
